Day 4: Managing the Linux Boot Process

Booting

Boot Loader Components
Boot sector (MBR) = First 512 bytes on disk
Second Stage Boot Loader = Loads OS and the kernel loader
Boot Loader Installer = Runs only when booting from a drive. Coordinates between boot sector and boot loader.

BIOS

UEFI - Has replaced BIOS

iso booting/mounting
dd if=/iso_image /dev/sdx bs=4M

pxe - boot to network


Sectors

Stores 512 byte by default

MBR

GPT (GUID Partition Table)

initrd

mkinitrd - creates initrd image for preloading the kernel modules
vmlinuz - executable for kernel

Boot Directory
/boot/ - Files that facilitate the Linux boot process

Old Systems: /boot/grub2
New Systems: /boot/efi/EFI/

grub.cfg is located in /boot/grub2/
the grub.cfg file is altered in /etc/grub2.cfg
/etc/grub.d/<>


BootProcess.png


GNU GRUB

grub2-mkconfig - Create new grub.cfg
- grub2-mkconfig > /boot/grub2/grub.cfg

grub2-install - Install GRUB on a storage device
grub2-efi - Copies GRUB2 files onto EFI system partition in /boot/efi


LAB

mkinitrd -v /boot/initrd-$(uname -r).img $(uname -r) - Create initrd image
mkinitrd -v --with=nfsv4 /boot/initrd-$(uname -r)-nfs.img $(uname -r) - Create initrd image with NFS module

grub2-mkpasswd-pbkdf2 | tee -a /etc/grub.d/40_custom - Create password to lock the GRUB2 configuration

vim /etc/grub.d/40_custom - Delete line with "PBKDF2 hash of password is" and replace with "password_pbkdf2 student01" and insert line above with "set superusers="student01"

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg - Create new config file